package com.lbmb.mdps.settings.controller;

import com.lbmb.mdps.commons.constant.Constant;
import com.lbmb.mdps.commons.domain.ReturnObjectVO;
import com.lbmb.mdps.commons.exception.AdministratorException;
import com.lbmb.mdps.commons.utils.Md5Util;
import com.lbmb.mdps.settings.domain.Administrator;
import com.lbmb.mdps.settings.service.AdministratorService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;

/**
 * @author 林文塨
 * @date 2022-05-30 1:46
 * description
 */

@CrossOrigin
@RestController
public class ProvinceCityController {

    @Resource
    private AdministratorService administratorService;

    @GetMapping( "/settings/provinceCity/getAddressData.do")
    public ReturnObjectVO getAddressData(HttpSession session) throws AdministratorException {
        /*
         * 获得省市表数据
         * @author 林文塨
         * @date 2022/5/30 11:28
         * @param [session]
         * @return com.lbmb.mdps.commons.domain.ReturnObjectVO
         */

        ReturnObjectVO rov = new ReturnObjectVO();

        ServletContext servletContext = session.getServletContext();
        Object addressData = servletContext.getAttribute(Constant.ADDRESS_DATA);

        rov.setCode(Constant.RETURN_OBJECT_CODE_SUCCESS);
        rov.setOthers(addressData);

        return rov;
    }
}
